home *** CD-ROM | disk | FTP | other *** search
/ Enigma Amiga Life 106 / EnigmaAmiga106CD.iso / software / grafica / perfectpaint / rexx / text / animation toolkit.rx next >
Encoding:
Text File  |  1999-08-26  |  7.5 KB  |  441 lines

  1. /*
  2.     Arexx Text Script
  3. */
  4.  
  5.     call addlib("rexxmathlib.library", 5, -30, 0)
  6.  
  7.     options results
  8.   parse ARG Port x y b
  9.     ADDRESS value Port
  10.  
  11.     pp_AvoidRefresh
  12.  
  13.     pp_CountFrames
  14.     Total_Frame=result
  15.     Start_Frame=1
  16.     End_Frame=Total_Frame
  17.     if End_Frame<2 then do
  18.         pp_Warn 'Make*an*Anim*first.'
  19.         pp_PermitRefresh
  20.         EXIT
  21.     end
  22.  
  23.     ADDRESS COMMAND
  24.  
  25.     file="Ram:T/pp_text"
  26.     IF OPEN('a',file,'R') then DO
  27.         trash=READLN('a')
  28.         trash=READLN('a')
  29.         Tsize=READLN('a')
  30.         Ttype=READLN('a')
  31.         trash=READLN('a')
  32.         trash=READLN('a')
  33.         trash=READLN('a')
  34.         trash=READLN('a')
  35.         Txdpi=READLN('a')
  36.         Tydpi=READLN('a')
  37.         Trot=READLN('a')
  38.         Tita=READLN('a')
  39.         trash=READLN('a')
  40.         trash=READLN('a')
  41.         trash=READLN('a')
  42.         trash=READLN('a')
  43.         trash=READLN('a')
  44.         trash=READLN('a')
  45.         Tw=READLN('a')
  46.         Th=READLN('a')
  47.         CALL CLOSE('a')
  48.  
  49.         Start_Rotation=Trot
  50.         End_Rotation=Trot
  51.  
  52.         Start_Italic=Tita
  53.         End_Italic=Tita
  54.  
  55.         Start_Size=Tsize
  56.         End_Size=Tsize
  57.  
  58.         Start_Xdpi=Txdpi
  59.         End_Xdpi=Txdpi
  60.  
  61.         Start_Ydpi=Tydpi
  62.         End_Ydpi=Tydpi
  63.  
  64.         Start_Flow=0
  65.         End_Flow=0
  66.  
  67.         Start_Opacity=100
  68.         End_Opacity=100
  69.     END
  70.     ELSE
  71.     DO
  72.         ADDRESS value Port
  73.         pp_Warn 'Make*a*Text*first.'
  74.         pp_PermitRefresh
  75.         EXIT
  76.         ADDRESS COMMAND        
  77.     END
  78.  
  79.     file="Ram:T/pp_move"
  80.     IF OPEN('b',file,'R') then DO
  81.         Start_Rotation=READLN('b')
  82.         End_Rotation=READLN('b')
  83.  
  84.         Start_Italic=READLN('b')
  85.         End_Italic=READLN('b')
  86.  
  87.         Start_Size=READLN('b')
  88.         End_Size=READLN('b')
  89.  
  90.         Start_Xdpi=READLN('b')
  91.         End_Xdpi=READLN('b')
  92.  
  93.         Start_Ydpi=READLN('b')
  94.         End_Ydpi=READLN('b')
  95.  
  96.         Start_Flow=READLN('b')
  97.         End_Flow=READLN('b')
  98.  
  99.         Start_Opacity=READLN('b')
  100.         End_Opacity=READLN('b')
  101.  
  102.         CALL CLOSE('b')
  103.     END
  104.  
  105.     R=-1
  106.  
  107.     ADDRESS value Port
  108.  
  109.     Path=0;Type=0
  110.  
  111. DO UNTIL R>-1
  112.  
  113.     D.2='*Frame*(*#'||Start_Frame||'->#'||End_Frame||'*)*'
  114.  
  115.     D.3='*Rotation*(*'||Start_Rotation||'*->*'||End_Rotation||'*)*'
  116.     D.4='*Italic*(*'||Start_Italic||'*->*'||End_Italic||'*)*'
  117.     D.5='*Size*(*'||Start_Size||'*->*'||End_Size||'*)*'
  118.     D.6='*ScaleX*(*'||Start_Xdpi||'*->*'||End_Xdpi||'*)*'
  119.     D.7='*ScaleY*(*'||Start_Ydpi||'*->*'||End_Ydpi||'*)*'
  120.  
  121.     D.8='*Flow*(*'||Start_Flow||'*->*'||End_Flow||'*)*'
  122.     D.9='*Opacity*(*'||Start_Opacity||'*->*'||End_Opacity||'*)*'
  123.  
  124.     pp_DialogInit 250 270 "*MOVE*" 10
  125.     pp_Cycle 0 70 5 100 16 "Path" 1 "None|Left|Right|Up|Down" Path
  126.     pp_Cycle 1 70 25 100 16 "Type" 1 "In|Out" Type
  127.         j=55
  128.         DO i=2 to 9
  129.             pp_Button i 20 j 200 16 D.i
  130.             j=j+20
  131.             if i=2 then DO;j=j+10;END
  132.             if i=7 then DO;j=j+10;END
  133.         END
  134.     pp_Dialog
  135.     R=result
  136.  
  137.     pp_GetDialog 0
  138.     Path=result
  139.  
  140.     pp_GetDialog 1
  141.     Type=result
  142.  
  143.     if R=-9 then DO
  144.         pp_DialogInit 150 80 "*OPACITY*" 2
  145.             pp_Integer 0 60 5 50 16 "Start" 1 Start_Opacity
  146.             pp_Integer 1 60 25 50 16 "End" 1 End_Opacity
  147.         pp_Dialog
  148.         rc=result
  149.         IF rc=1 then DO
  150.             pp_GetDialog 0
  151.             Start_Opacity=result
  152.  
  153.             pp_GetDialog 1
  154.             End_Opacity=result        
  155.         END            
  156.     END
  157.  
  158.     if R=-8 then DO
  159.         pp_DialogInit 150 80 "*FLOW*" 2
  160.             pp_Integer 0 60 5 50 16 "Start" 1 Start_Flow
  161.             pp_Integer 1 60 25 50 16 "End" 1 End_Flow
  162.         pp_Dialog
  163.         rc=result
  164.         IF rc=1 then DO
  165.             pp_GetDialog 0
  166.             Start_Flow=result
  167.  
  168.             pp_GetDialog 1
  169.             End_Flow=result    
  170.         END            
  171.     END
  172.  
  173.     if R=-5 then DO
  174.         pp_DialogInit 150 80 "*SIZE*" 2
  175.             pp_Integer 0 60 5 50 16 "Start" 1 Start_Size
  176.             pp_Integer 1 60 25 50 16 "End" 1 End_Size
  177.         pp_Dialog
  178.         rc=result
  179.         IF rc=1 then DO
  180.             pp_GetDialog 0
  181.             Start_Size=result
  182.  
  183.             pp_GetDialog 1
  184.             End_Size=result        
  185.         END            
  186.     END
  187.  
  188.     if R=-6 then DO
  189.         pp_DialogInit 150 80 "*SCALE*X*" 2
  190.             pp_Integer 0 60 5 50 16 "Start" 1 Start_Xdpi
  191.             pp_Integer 1 60 25 50 16 "End" 1 End_Xdpi
  192.         pp_Dialog
  193.         rc=result
  194.         IF rc=1 then DO
  195.             pp_GetDialog 0
  196.             Start_Xdpi=result
  197.  
  198.             pp_GetDialog 1
  199.             End_Xdpi=result        
  200.         END            
  201.     END
  202.  
  203.     if R=-7 then DO
  204.         pp_DialogInit 150 80 "*SCALE*Y*" 2
  205.             pp_Integer 0 60 5 50 16 "Start" 1 Start_Ydpi
  206.             pp_Integer 1 60 25 50 16 "End" 1 End_Ydpi
  207.         pp_Dialog
  208.         rc=result
  209.         IF rc=1 then DO
  210.             pp_GetDialog 0
  211.             Start_Ydpi=result
  212.  
  213.             pp_GetDialog 1
  214.             End_Ydpi=result        
  215.         END            
  216.     END
  217.  
  218.     if R=-2 then DO
  219.         pp_DialogInit 150 80 "*FRAME*" 2
  220.             pp_Integer 0 60 5 50 16 "Start" 1 Start_Frame
  221.             pp_Integer 1 60 25 50 16 "End" 1 End_Frame
  222.         pp_Dialog
  223.         rc=result
  224.         IF rc=1 then DO
  225.             pp_GetDialog 0
  226.             Start_Frame=result
  227.  
  228.             pp_GetDialog 1
  229.             End_Frame=result
  230.  
  231.             IF End_Frame>Total_Frame THEN DO
  232.                 End_Frame=Total_Frame
  233.             END
  234.  
  235.             IF Start_Frame>End_Frame THEN DO
  236.                 Start_Frame=1
  237.             END
  238.  
  239.         END            
  240.     END
  241.  
  242.     if R=-3 then DO
  243.         pp_DialogInit 150 80 "*ROTATION*" 2
  244.             pp_Integer 0 60 5 50 16 "Start" 1 Start_Rotation
  245.             pp_Integer 1 60 25 50 16 "End" 1 End_Rotation
  246.         pp_Dialog
  247.         rc=result
  248.         IF rc=1 then DO
  249.             pp_GetDialog 0
  250.             Start_Rotation=result
  251.  
  252.             pp_GetDialog 1
  253.             End_Rotation=result        
  254.         END            
  255.     END
  256.  
  257.     if R=-4 then DO
  258.         pp_DialogInit 150 80 "*ITALIC*" 2
  259.             pp_Integer 0 60 5 50 16 "Start" 1 Start_Italic
  260.             pp_Integer 1 60 25 50 16 "End" 1 End_Italic
  261.         pp_Dialog
  262.         rc=result
  263.         IF rc=1 then DO
  264.  
  265.             pp_GetDialog 0
  266.             Start_Italic=result
  267.             IF Start_Italic>45 then DO
  268.                 Start_Italic=45
  269.             END
  270.             IF Start_Italic<-45 then DO
  271.                 Start_Italic=-45
  272.             END
  273.  
  274.             pp_GetDialog 1
  275.             End_Italic=result    
  276.             IF End_Italic>45 then DO
  277.                 End_Italic=45
  278.             END
  279.             IF End_Italic<-45 then DO
  280.                 End_Italic=-45
  281.             END
  282.  
  283.         END            
  284.     END
  285. END
  286.  
  287.     if R=0 then DO
  288.         pp_PermitRefresh
  289.         EXIT
  290.     END    
  291.     
  292.     ADDRESS COMMAND
  293.  
  294.     file='ram:t/pp_move'
  295.  
  296.     IF EXISTS(file) THEN DO
  297.         'delete >nil: ram:t/pp_move'
  298.     END
  299.  
  300.     IF OPEN('c',file,'W') then DO
  301.  
  302.         CALL WRITELN('c',Start_Rotation)
  303.         CALL WRITELN('c',End_Rotation)
  304.  
  305.         CALL WRITELN('c',Start_Italic)
  306.         CALL WRITELN('c',End_Italic)
  307.  
  308.         CALL WRITELN('c',Start_Size)
  309.         CALL WRITELN('c',End_Size)
  310.  
  311.         CALL WRITELN('c',Start_Xdpi)
  312.         CALL WRITELN('c',End_Xdpi)
  313.  
  314.         CALL WRITELN('c',Start_Ydpi)
  315.         CALL WRITELN('c',End_Ydpi)
  316.  
  317.         CALL WRITELN('c',Start_Flow)
  318.         CALL WRITELN('c',End_Flow)
  319.  
  320.         CALL WRITELN('c',Start_Opacity)
  321.         CALL WRITELN('c',End_Opacity)
  322.  
  323.         CALL CLOSE('c')
  324.     END
  325.  
  326.     ADDRESS value Port
  327.  
  328.     pp_GetWidth
  329.     W=result
  330.  
  331.     pp_GetHeight
  332.     H=result
  333.  
  334.     HX=Tw/2
  335.     HY=Th/2
  336.  
  337.     Start_X=x
  338.     End_X=x
  339.     Start_Y=y
  340.     End_Y=y
  341.  
  342.     IF Path=1 then DO
  343.         IF Type=0 then DO
  344.             Start_X=HX*-1
  345.         END
  346.         ELSE
  347.         DO
  348.             End_X=HX*-1
  349.         END
  350.     END
  351.  
  352.     IF Path=2 then DO
  353.         IF Type=0 then DO
  354.             Start_X=W+HX
  355.         END
  356.         ELSE
  357.         DO
  358.             End_X=W+HX
  359.         END
  360.     END
  361.  
  362.     IF Path=3 then DO
  363.         IF Type=0 then DO
  364.             Start_Y=HY*-1
  365.         END
  366.         ELSE
  367.         DO
  368.             End_Y=HY*-1
  369.         END
  370.     END
  371.  
  372.     IF Path=4 then DO
  373.         IF Type=0 then DO
  374.             Start_Y=H+HY
  375.         END
  376.         ELSE
  377.         DO
  378.             End_Y=H+HY
  379.         END
  380.     END
  381.  
  382.     step=(End_Frame-Start_Frame)
  383.  
  384.     Step_Rotation=(End_Rotation-Start_Rotation)/Step
  385.     Step_Italic=(End_Italic-Start_Italic)/Step
  386.     Step_Xdpi=(End_Xdpi-Start_Xdpi)/Step
  387.     Step_Ydpi=(End_Ydpi-Start_Ydpi)/Step
  388.     Step_Size=(End_Size-Start_Size)/Step
  389.  
  390.     Step_Flow=(End_Flow-Start_Flow)/Step
  391.     Step_Opacity=(End_Opacity-Start_Opacity)/Step
  392.  
  393.     Step_X=(End_X-Start_X)/Step
  394.     Step_Y=(End_Y-Start_Y)/Step
  395.     
  396.  
  397.     DO i=Start_Frame to End_Frame
  398.  
  399.         pp_GotoFrame i
  400.  
  401.         Rotation=trunc(Start_Rotation+Step_Rotation*(i-Start_Frame)+0.5,0)
  402.         Italic=trunc(Start_Italic+Step_Italic*(i-Start_Frame)+0.5,0)
  403.         Xdpi=trunc(Start_Xdpi+Step_Xdpi*(i-Start_Frame)+0.5,0)
  404.         Ydpi=trunc(Start_Ydpi+Step_Ydpi*(i-Start_Frame)+0.5,0)
  405.         Size=trunc(Start_Size+Step_Size*(i-Start_Frame)+0.5,0)
  406.         
  407.         Flow=trunc(Start_Flow+Step_Flow*(i-Start_Frame)+0.5,0)
  408.         Opacity=trunc(Start_Opacity+Step_Opacity*(i-Start_Frame)+0.5,0)
  409.  
  410.         X=trunc(Start_X+Step_X*(i-Start_Frame)+0.5,0)
  411.         Y=trunc(Start_Y+Step_Y*(i-Start_Frame)+0.5,0)
  412.         
  413.         IF Flow>3 then DO
  414.             pp_EffectOn
  415.             pp_AirBrush Opacity Flow
  416.         END
  417.         ELSE
  418.         IF Opacity<100 then DO
  419.             pp_EffectOn
  420.             pp_Trans Opacity
  421.         END
  422.  
  423.         IF Opacity>0 then DO
  424.             pp_TextXDPI Xdpi
  425.             pp_TextYDPI Ydpi
  426.             pp_TextItalic Italic
  427.             pp_TextRotate Rotation
  428.             pp_TextSize Size
  429.             pp_TextMake
  430.             pp_TextDraw X Y
  431.         END
  432.  
  433.         pp_EffectOff
  434.  
  435.     END
  436.  
  437.     pp_GotoFrame Start_Frame
  438.     pp_TextRestore
  439.     pp_TextMake
  440.     pp_PermitRefresh
  441.